package com.jadesoft.leaf;

import com.ufida.commons.IPublished;
import java.io.Serializable;
import org.hibernate.type.Type;

public class HQLInfo implements IPublished, Serializable, Cloneable {
	private static final long serialVersionUID = 390917910275162862L;
	private String hql;
	private String[] paraNames = new String[0];

	private Object[] paraValues = new Object[0];

	private Type[] paraTypes = new Type[0];
	private Class entityClass;

	public HQLInfo(String hql, String[] paraNames, Object[] paraValues) {
		this.hql = hql;
		this.paraNames = paraNames;
		this.paraValues = paraValues;
	}

	public HQLInfo(String hql, Object[] paraValues, Type[] paraTypes) {
		this.hql = hql;
		this.paraTypes = paraTypes;
		this.paraValues = paraValues;
	}

	public HQLInfo(String hql) {
		this.hql = hql;
	}

	public String getHql() {
		return this.hql;
	}

	public void setHql(String hql) {
		this.hql = hql;
	}

	public String[] getParaNames() {
		return this.paraNames;
	}

	public void setParaNames(String[] paraNames) {
		this.paraNames = paraNames;
	}

	public Object[] getParaValues() {
		return this.paraValues;
	}

	public void setParaValues(Object[] paraValues) {
		this.paraValues = paraValues;
	}

	public Type[] getParaTypes() {
		return this.paraTypes;
	}

	public void setParaTypes(Type[] paraTypes) {
		this.paraTypes = paraTypes;
	}

	public Class getEntityClass() {
		return this.entityClass;
	}

	public void setEntityClass(Class entityClass) {
		this.entityClass = entityClass;
	}

	public Object clone() throws CloneNotSupportedException {
		HQLInfo hi = null;
		try {
			hi = (HQLInfo) super.clone();
			hi.setParaNames((String[]) this.paraNames.clone());
			hi.setParaTypes((Type[]) getParaTypes().clone());
			hi.setParaValues((Object[]) getParaValues().clone());
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return hi;
	}
}
